package net.jueb.sniff4j.extr.auth;

import io.netty.channel.Channel;

import java.net.InetSocketAddress;

import net.jueb.sniff4j.extr.base.AbstractRuntime;
import net.jueb.sniff4j.extr.filter.DefaultObjectFilter;

public abstract class User {
	
	private final String name;
	private String passwd;
	private final AddressCollection refuseTargets=new AddressCollection();
	/**
	 * 地址重定向集合
	 */
	private final AddressRedirectCollection targetRedirects=new AddressRedirectCollection();
	
	public User(String name, String passwd) {
		this.name = name;
		this.passwd = passwd;
	}
	public String getName() {
		return this.name;
	}
	public String getPasswd() {
		return this.passwd;
	}
	public void setPasswd(String passwd) {
		this.passwd = passwd;
	}
	public AddressCollection getRefuseTargets() {
		return this.refuseTargets;
	}
	public void addRefuseTarget(InetSocketAddress targetAddress)
	{
		this.refuseTargets.add(targetAddress);
	}
	public final AddressRedirectCollection getTargetRedirects() {
		return targetRedirects;
	}
	
	/**
	 * 用户级别的重建过滤器，优先级大于服务端
	 * @param fromChannel
	 * @param toChannel
	 * @return
	 */
	public  abstract DefaultObjectFilter getSendToClientFilter(Channel fromChannel,Channel toChannel,AbstractRuntime runtime); 
	/**
	 * 用户级别的重建过滤器，优先级大于服务端
	 * @param fromChannel
	 * @param toChannel
	 * @return
	 */
	public  abstract DefaultObjectFilter getSendToTargetFilter(Channel fromChannel,Channel toChannel,AbstractRuntime runtime);
}
